package com.edoomath.api.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dao;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;
import com.edoomath.entity.course.Product;
import com.edoomath.entity.course.Sku;

/**
 *
 * @author Ark
 *
 */
@Dao("hibernate")
public interface SkuDao {
	
	/**
	 * 
	 * @param id
	 * @return
	 */
	@Query("FROM Sku WHERE disabled = false AND id = :id")
	public Sku load(@Variable("id") Long id);
    
    /**
     * 
     * @return
     */
    @Query("FROM Sku WHERE disabled = false AND display = true AND hot = true")
    public List<Sku> listHot();
    
    /**
     * 
     * @param type
     * @return
     */
    @Query("FROM Sku WHERE disabled = false AND display = true AND type = :type")
    public List<Sku> list(@Variable("type") String type);

    /**
     * @param product
     * @return
     */
    @Query("FROM Sku WHERE disabled = false AND product = :product")
    public List<Sku> list(@Variable("product") Product product);
    
}
